package ru.papergames.battleserver.model.battle.map;

import ru.papergames.battleserver.model.battle.map.Obstacle.BlockedCell;

public class ObstaclesFactory {

    private static final int GRASS_IMG_ID       = 3000;
    private static final int BAK1_IMG_ID        = 3001;
    private static final int BAK2_IMG_ID        = 3002;
    private static final int BAK3_IMG_ID        = 3003;
    private static final int SANDBAGS01_IMG_ID  = 3004;
    private static final int SANDBAGS02_IMG_ID  = 3005;
    private static final int SANDBAGS03_IMG_ID  = 3006;
    private static final int SANDBAGS04_IMG_ID  = 3007;
    private static final int TELEGA1_IMG_ID     = 3008;
    private static final int TELEGA2_IMG_ID     = 3009;

    public static Obstacle createGrassObstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{new BlockedCell(0, 0)};
        Obstacle obstacle = new Obstacle(1, 0, 1, 1, blockedCells);
        obstacle.setImageId(GRASS_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);
        return obstacle;
    }

    public static Obstacle createBak1Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{
                new BlockedCell(0, 1), new BlockedCell(1, 1), new BlockedCell(2, 1)
        };
        Obstacle obstacle = new Obstacle(2, 0, 3, 2, blockedCells);
        obstacle.setImageId(BAK1_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.3f);

        return obstacle;
    }

    public static Obstacle createBak2Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{new BlockedCell(0, 1)};
        Obstacle obstacle = new Obstacle(3, 0, 1, 2, blockedCells);
        obstacle.setImageId(BAK2_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.3f);

        return obstacle;
    }

    public static Obstacle createBak3Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{new BlockedCell(0, 1)};
        Obstacle obstacle = new Obstacle(4, 0, 1, 2, blockedCells);
        obstacle.setImageId(BAK3_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.3f);

        return obstacle;
    }

    public static Obstacle createSandbags01Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{
                new BlockedCell(0, 1), new BlockedCell(1, 1), new BlockedCell(2, 1)
        };
        Obstacle obstacle = new Obstacle(5, 0, 3, 2, blockedCells);
        obstacle.setImageId(SANDBAGS01_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.7f);

        return obstacle;
    }

    public static Obstacle createSandbags02Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{
                new BlockedCell(0, 0),
                new BlockedCell(0, 1),
                new BlockedCell(0, 2),
                new BlockedCell(0, 3)
        };
        Obstacle obstacle = new Obstacle(6, 0, 1, 4, blockedCells);
        obstacle.setImageId(SANDBAGS02_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.7f);

        return obstacle;
    }

    public static Obstacle createSandbags03Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{
                                                              new BlockedCell(2, 0),
                                                              new BlockedCell(2, 1),
                new BlockedCell(0, 2), new BlockedCell(1, 2), new BlockedCell(2, 2)
        };
        Obstacle obstacle = new Obstacle(7, 0, 3, 3, blockedCells);
        obstacle.setImageId(SANDBAGS03_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.7f);

        return obstacle;
    }

    public static Obstacle createSandbags04Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{
                new BlockedCell(0, 1), new BlockedCell(1, 1), new BlockedCell(2, 1),
                new BlockedCell(0, 2),
                new BlockedCell(0, 3)
        };
        Obstacle obstacle = new Obstacle(8, 0, 3, 4, blockedCells);
        obstacle.setImageId(SANDBAGS04_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.7f);

        return obstacle;
    }

    public static Obstacle createTelega1Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{new BlockedCell(0, 0)};
        Obstacle obstacle = new Obstacle(9, 0, 1, 1, blockedCells);
        obstacle.setImageId(TELEGA1_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.5f);

        return obstacle;
    }

    public static Obstacle createTelega2Obstacle(int leftUpConnerX, int leftUpConnerY) {
        BlockedCell[] blockedCells = new BlockedCell[]{new BlockedCell(0, 1)};
        Obstacle obstacle = new Obstacle(10, 0, 1, 2, blockedCells);
        obstacle.setImageId(TELEGA2_IMG_ID);
        obstacle.setLeftUpConnerX(leftUpConnerX);
        obstacle.setLeftUpConnerY(leftUpConnerY);

        obstacle.setArmour(.1f);

        return obstacle;
    }

}
